package com.cloud.controller;

import com.cloud.config.Log;
import com.cloud.domain.LoginUser;
import com.cloud.pojo.UserApplyVolunteer;
import com.cloud.service.ApplyVolunteerService;
import com.cloud.enumeration.ApplyState;
import com.cloud.tools.CommonResult;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 *
 * @author： linJianHong
 * @dateTime： 21:16 2022/4/17
 * @Description: Approver handle user's apply for volunteer control layer
 * @ClassName: ApproveVolunteerApplyController
 */

@RequestMapping("/approval/volunteerApply")
@RestController
public class ApprovalVolunteerApplyController {

    @Resource
    ApplyVolunteerService applyVolunteerService;

    /* 审批员查看志愿者申请 */
    @GetMapping(value = "/retrieve")
    @PreAuthorize("hasAnyAuthority('approve:read')")
    public CommonResult volunteerApplyRetrieve(){
        return applyVolunteerService.approvalRetrieve();
    }

    /* 审批员处理志愿者申请 */
    @PostMapping(value = "/handle")
    @PreAuthorize("hasAnyAuthority('approve:update')")
    @Log("审批员处理志愿者申请")
    public CommonResult volunteerApplyHandle(@RequestBody Map<String,Object> maps){
        return applyVolunteerService.approvalUpdate(maps);
    }

}
